home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / hardware / host.arc / HOST.BAT < prev    next >
DOS Batch File  |  1989-01-31  |  4KB  |  85 lines

  1. echo off
  2. REM  HOST.bat by Hale Pringle, University of Central Florida, LAN Institute.
  3. REM  Note: this could just as easily be used with PC Anywhere, or REMOTE
  4. REM  Objective:  Have my office phone answered by a modem with CC at night
  5. REM  and during weekends and answered normally during office hours.
  6. REM  HOST.bat will wait until 18:00 and then boot Carbon Copy and wait for
  7. REM  a call.  At 7:00 the next morning the PC reboots and the modem is disabled
  8. REM  until 18:00 that night.  On weekend the PC reinstalls CC.
  9. REM  During the day (7:00 to 18:00) the phone is answered normally.
  10. REM  At night (18:00 until 7:00) and during weekends the phone is answered by
  11. REM  a modem attached to my PC which has Carbon Copy running.
  12. REM 
  13. REM  If you type HOST when you leave the office
  14. REM     If the time is before 18:00 the PC waits and then install CC
  15. REM     If the time is after 18:00 it boots CC immediately.
  16. REM
  17. REM  This system needs  DAYCHECK.exe, WAITUTIL.com & REBOOT.com to execute.
  18. REM  HOST.bat needs to be in the root of C:.  The rest should be in a sub-
  19. REM  directory called CARBON.
  20. REM
  21. REM  First get to the C: drive and to the Carbon subdirectory
  22. c:
  23. cd \
  24. cd \carbon
  25. REM Next create a FLAG for autoexec.bat file to see.
  26. REM I put the line IF EXIST C:\CARBON\DOcc.BAT host
  27. REM at the end of my autoexec.bat file.  If the file exists, I ran HOST
  28. REM Everywhere that this batch file goes into a wait state I erase DOCC.BAT
  29. REM If I CTRL BREAK out of the batch and do not rerun HOST, the autoexec will
  30. REM not call HOST.BAT.  If the wait state finishes without me and the PC
  31. REM automatically reboots, this batch will be run again.
  32. copy c:\host.bat DOcc.bat > nul:
  33. rem ECHO CASTOFF will give 'Bad Command or File name' if you are off your network
  34. ECHO CASTOFF
  35. CASTOFF > nul:
  36. ECHO BREAK
  37. BREAK=ON  > nul:
  38. echo .
  39. echo off
  40. REM   First what day is it?  Sat & Sun load carbon copy, else wait for 18:00
  41. DAYCHECK DAY
  42. rem Sunday
  43. if errorlevel  0  if not errorlevel  1  echo SUNDAY
  44. if errorlevel  0  if not errorlevel  1  goto :DOCC
  45. rem Monday...
  46. if errorlevel  1  if not errorlevel  6  echo MONDAY THRU FRIDAY
  47. if errorlevel  1  if not errorlevel  6  goto :CHK
  48. rem Saturday
  49. if errorlevel  6  if not errorlevel  7  echo SATURDAY
  50. if errorlevel  6  if not errorlevel  7  goto :DOCC
  51. echo .
  52. ECHO Should not get here...(bad DOW)
  53. :CHK
  54. REM  Next check the hour.  If after 18:00 load CC, else wait for 18:00
  55. DAYCHECK HOUR
  56. if errorlevel  0 if not errorlevel  7 echo BEFORE 7 am
  57. if errorlevel  0 if not errorlevel  7 goto  :DOCC
  58. if errorlevel  7 if not errorlevel 18 echo AFTER 7 AM AND BEFORE 6 PM
  59. if errorlevel  7 if not errorlevel 18 goto :wait18
  60. if errorlevel  18 if not errorlevel 23 echo AFTER 6 PM
  61. if errorlevel  18 if not errorlevel 23 goto :DOCC
  62. ECHO Should not get here...(bad hour)
  63. :wait18
  64. REM If I CTRL BREAK here or reboot here, I do not want Carbon Copy to load
  65. erase docc.bat >nul:              
  66. echo .
  67. ECHO Press CTRL BREAK and say Y (exit batch file) to work without Carbon Copy
  68. ECHO WAIT for 18:00
  69. WAITUNTL 18:00:00
  70. :DOCC
  71. CC
  72. REM If I CTRL BREAK here or reboot here, I DO want Carbon Copy to load
  73. echo .
  74. ECHO Press CTRL BREAK and say Y (exit batch file) to work with Carbon Copy
  75. ECHO remotely.   Erase C:\CARBON\DOCC.bat to boot after 18:00 without CC.
  76. ECHO WAIT for 7:00
  77. copy c:\host.bat docc.bat >nul:
  78. WAITUNTL 07:00:00
  79. REM If this has executed, I want HOST.BAT rerun, wait for 18:00, redo CC, etc.
  80. copy c:\host.bat docc.bat >nul:
  81. reboot
  82. REM Remember, the line in AUTOEXEC.BAT will call host.bat if this executes.
  83.  
  84.  
  85.